import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

import WindiCSS from "vite-plugin-windicss";

//import { viteMockServe } from "vite-plugin-mock";

import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";

// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
  return {
    plugins: [
      vue(),
      // viteMockServe({
      //   // default
      //   mockPath: "mock",
      //   localEnabled: command === "serve",
      // }),
      WindiCSS({
        config: {
          shortcuts: {
            "flex-center": "flex justify-center items-center",
          },
        },
      }),
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
    ],
    resolve: {
      alias: {
        "@": fileURLToPath(new URL("./src", import.meta.url)),
      },
    },
    server: {
      proxy: {
        "/assist": {
          target: "http://192.168.0.72:8888",
        },
      },
    },
    base: '/dn'
  };
});
